import type { ITemplate } from '@/api/modules/esl/template';
import type { Rule } from 'ant-design-vue/es/form';

const formObj: ITemplate = {
  templateName: '',
  templateColor: '',
  templateData: undefined,
  imgSrc: '',
  scale: 0,
  deptId: '',
  share: '0',
  resolution: {
    resolutionId: '',
    width: 0,
    height: 0,
    description: '',
    dpi: 0,
    scale: 0,
    toRotate: 0,
  },
  resolutionDesc: '',
  resolutionWidth: 0,
  resolutionHeight: 0,
  templateList: [],
  major: undefined,
};
export const form = ref({
  ...formObj,
});

export const formRef = ref();

export const resetForm = () => {
  form.value = {
    ...formObj,
  };
};
export const formRules: Record<keyof ITemplate, Rule[]> = {
  resolutionId: [],
  scale: [],
  templateId: [],
  templateName: [{ required: true }],
  templateColor: [],
  templateData: [],
  imgSrc: [],
  deptId: [],
  share: [],
  resolution: [],
  resolutionDesc: [],
  resolutionWidth: [],
  resolutionHeight: [],
  templateList: [],
  major: [],
  goodsList: [],
};
